package com.cloud.picture.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cloud.picture.mapper.PictureLikeMapper;
import com.cloud.picture.model.entity.PictureLike;
import com.cloud.picture.service.PictureLikeService;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
* @author win
* @description 针对表【picture_like(图片点赞列表)】的数据库操作Service实现
* @createDate 2025-03-01 12:25:15
*/
@Service
public class PictureLikeServiceImpl extends ServiceImpl<PictureLikeMapper, PictureLike>
    implements PictureLikeService{

    @Override
    public List<Long> getLikePictureIds(Long userId) {
        // 查询
        QueryWrapper<PictureLike> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("user_id", userId);
        return this.baseMapper.selectList(queryWrapper)
                .stream().map(PictureLike::getPictureId)
                .collect(Collectors.toList());
    }
}




